package com.lqg.bookLibrary.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author prodigal_lqg
 * @since 2023-04-09 
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("books")
public class Books implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 书籍ID，自增主键
     */
    @TableId("book_id")
    private Long bookId;

    /**
     * 书籍标题
     */
    @TableField("title")
    private String title;

    /**
     * 作者
     */
    @TableField("author")
    private String author;

    /**
     * 书籍出版商
     */
    @TableField("publisher")
    private String publisher;

    /**
     * 书籍出版日期
     */
    @TableField("publication_date")
    private LocalDate publicationDate;

    /**
     * 书籍简介
     */
    @TableField("summary")
    private String summary;

    /**
     * 书籍封面图片的URL
     */
    @TableField("image_url")
    private String imageUrl;

    /**
     * 平均评分
     */
    //@TableField("avg_score")
    //private Integer avgScore;

    /**
     * 图书类型id
     */
    @TableField("type_id")
    private Integer typeId;

    /**
     * 创建时间
     */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    /**
     * 最后更新时间
     */
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    public Books(Long bookId, String title, String author) {
        this.bookId = bookId;
        this.title = title;
        this.author = author;
    }
}
